package com.lrkj.payfee.service.impl;

import java.util.List;
import com.lrkj.common.utils.DateUtils;
import com.lrkj.common.utils.uuid.IdUtils;
import com.lrkj.payfee.vo.RoomBalanceListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lrkj.payfee.mapper.RoomBalanceMapper;
import com.lrkj.payfee.domain.RoomBalance;
import com.lrkj.payfee.service.IRoomBalanceService;

/**
 * 账户余额Service业务层处理
 *
 * @author yajun_ren
 * @date 2022-07-25
 */
@Service
public class RoomBalanceServiceImpl implements IRoomBalanceService
{
    @Autowired
    private RoomBalanceMapper roomBalanceMapper;

    /**
     * 查询账户余额
     *
     * @param id 账户余额ID
     * @return 账户余额
     */
    @Override
    public RoomBalance selectRoomBalanceById(String id)
    {
        return roomBalanceMapper.selectRoomBalanceById(id);
    }

    /**
     * 查询账户余额列表
     *
     * @param roomBalance 账户余额
     * @return 账户余额
     */
    @Override
    public List<RoomBalance> selectRoomBalanceList(RoomBalance roomBalance)
    {
        return roomBalanceMapper.selectRoomBalanceList(roomBalance);
    }

    @Override
    public RoomBalance selectRoomBalance(RoomBalance roomBalance) {
        return roomBalanceMapper.selectRoomBalance(roomBalance);
    }

    @Override
    public List<RoomBalanceListVo> selectRoomBalanceByNodeList(RoomBalanceListVo roomBalanceListVo) {
        return roomBalanceMapper.selectRoomBalanceByNodeList(roomBalanceListVo);
    }

    /**
     * 新增账户余额
     *
     * @param roomBalance 账户余额
     * @return 结果
     */
    @Override
    public int insertRoomBalance(RoomBalance roomBalance)
    {
        roomBalance.setId(IdUtils.simpleUUID());
        roomBalance.setCreateTime(DateUtils.getNowDate());
        roomBalance.setUpdateTime(DateUtils.getNowDate());
        return roomBalanceMapper.insertRoomBalance(roomBalance);
    }

    /**
     * 修改账户余额
     *
     * @param roomBalance 账户余额
     * @return 结果
     */
    @Override
    public int updateRoomBalance(RoomBalance roomBalance)
    {
        roomBalance.setUpdateTime(DateUtils.getNowDate());
        return roomBalanceMapper.updateRoomBalance(roomBalance);
    }

    /**
     * 批量删除账户余额
     *
     * @param ids 需要删除的账户余额ID
     * @return 结果
     */
    @Override
    public int deleteRoomBalanceByIds(String[] ids)
    {
        return roomBalanceMapper.deleteRoomBalanceByIds(ids);
    }

    /**
     * 删除账户余额信息
     *
     * @param id 账户余额ID
     * @return 结果
     */
    @Override
    public int deleteRoomBalanceById(String id)
    {
        return roomBalanceMapper.deleteRoomBalanceById(id);
    }
    /**
     * 批量新增账户余额信息
     *
     * @param roomBalances 账户余额对象
     */
    public int batchAddData(List<RoomBalance> roomBalances)
    {
           return roomBalanceMapper.batchAddData(roomBalances);
    }
}
